|
|
|
BlueCielo Meridian Enterprise 2013 Developer's Guide | BlueCielo ECM Solutions |
If you have created some functionality in Visual Basic that you would like to access using VBScript, it can be done with the AMCreateObject function in VBScript as shown in the following example:
Dim myCommandObject 'Define a name for your object Sub myCommand_Initialize(Batch)
'Create the object
Set MyCommandObject = AMCreateObject("AMCmdSet.Test",True)
End Sub Sub myCommand_Execute(Batch)
If Not Document Is Nothing Then
If Not myCommandObject.ResetCustomProperties(Document.ID) Then
'Call a custom function from the DLL
Call batch.Abort("Failed on document : " & Document.FileName )
End If
End If
End Sub
This example calls AMCmdSet.Test, which is a program ID in a custom ActiveX DLL. The custom DLL is installed and registered on the server in this case, denoted by passing True to AMCreateObject.
It is important to delete your object when you are done with it, as in the following example:
Sub myCommand_Terminate(Batch)
Set MyCommandObject = Nothing 'Delete Object
End Sub
AMCreateObject should not be confused with the CreateObject function in VBScript. AMCreateObject is designed to allow you to execute functionality during a Meridian Enterprise transaction. Following is example code for an ActiveX DLL that uses a new interface that allows the AMCreateObject function to supply the transaction. The IAMCommandSetInitialize interface is required for all objects that are created using AMCreateObject.
Implements IAMCommandSetInitialize
Private m_DocumentRepository As AMEDM.IAMDocumentRepository13 Private Sub IAMCommandSetInitialize_InitializeCommandSet(ByVal Repository As AMEDM.IAMDocumentRepository)
Set m_DocumentRepository = Repository
End Sub Private Sub Class_Terminate()
If Not m_DocumentRepository Is Nothing Then
Set m_DocumentRepository = Nothing
End If
End Sub
Copyright © 2000-2013 BlueCielo ECM Solutions |